﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace IT_Pro.Class
{
    class TK_ThongKe
    {

        public static DataTable LoadDsDTCSHT(int phong)
        {
            string strSQL = "select * from NV_NhanVien left join  NV_ChinhSachHeThong on NV_NhanVien.MaNV=NV_ChinhSachHeThong.MaNV "+
				 "left join NV_CodeDienThoai on NV_NhanVien.MaNV=NV_CodeDienThoai.MaNV";

            if (phong != 0)
            {
                strSQL = "select * from NV_NhanVien left join  NV_ChinhSachHeThong on NV_NhanVien.MaNV=NV_ChinhSachHeThong.MaNV " +
                 "left join NV_CodeDienThoai on NV_NhanVien.MaNV=NV_CodeDienThoai.MaNV " +
                 "where NV_NhanVien.PHG='" + phong + "'";
            }
            return DataServices.ExecQuery(strSQL);
        }

        public static DataTable LoadDsBanGiao(int phong)
        {
            string strSQL = "select * from NV_NhanVien left join  CV_BanGiaoThietBi on NV_NhanVien.MaNV=CV_BanGiaoThietBi.NguoiNhan and CV_BanGiaoThietBi.Giu='1'";

            if (phong != 0)
            {
                strSQL = "select * from NV_NhanVien left join  CV_BanGiaoThietBi on NV_NhanVien.MaNV=CV_BanGiaoThietBi.NguoiNhan and CV_BanGiaoThietBi.Giu='1'" +
                 "where NV_NhanVien.PHG='" + phong + "'";
            }
            return DataServices.ExecQuery(strSQL);
        }

        public static DataTable LOG_ChinhSachHeThong_GetList()
        {
            string proName = "LOG_ChinhSachHeThong_GetList";
            DataTable table = DataServices.ExcuteProcedureGetTable(proName, null);
            return table;
        }
        public static DataTable LOG_Online_GetList()
        {
            string proName = "LOG_Online_GetList";
            DataTable table = DataServices.ExcuteProcedureGetTable(proName, null);
            return table;
        }

    }
}
